package com.swak.exception;

/**
 * 超时异常
 * 
 * @author lifeng
 * @date 2020年8月22日 下午5:03:35
 */
public class TimeoutException extends RemotingException {

	private static final long serialVersionUID = 1L;
	private final int phase;
	public static final int CLIENT_SIDE = 0;
	public static final int SERVER_SIDE = 1;

	public TimeoutException(boolean serverSide, String msg) {
		super(msg);
		this.phase = serverSide ? SERVER_SIDE : CLIENT_SIDE;
	}

	public TimeoutException(boolean serverSide, Throwable error) {
		super(error);
		this.phase = serverSide ? SERVER_SIDE : CLIENT_SIDE;
	}

	public int getPhase() {
		return phase;
	}

	public boolean isServerSide() {
		return phase == 1;
	}

	public boolean isClientSide() {
		return phase == 0;
	}
}